package com.helloscala.web.snippet

import scala.language.implicitConversions

import scala.xml.NodeSeq
import net.liftweb.common.{Empty, Failure, Full, Box}

trait SnippetTrait {
  protected implicit def _box2nodeSeq(in: Box[NodeSeq]): NodeSeq =
    in match {
      case Full(nodeSeq) =>
        nodeSeq
      case Failure(msg, e, _) =>
        <h1 class="text-danger">
          {msg}
        </h1>
      case Empty =>
        <h1 class="text-danger">系统错误！</h1>
    }
}
